Prior Authorization Support System API - Implementation Template
Developer guide
Prior Authorization Developer Guide
Prior Authorization provides helper functions for mapping FHIR objects to X12 ones and reverse.
| Module | Description |
|---|---|
| fhirtoAdditionalInfo275 | Module that provides support for submit 275 request mapping. |
| fhirToSubmitRequest278 | Module that provides support for submit 278 request mapping. |
| submitResponse278toFHIR | Module that provides support for submit 278 response mapping. |
| claimInquiryResponse278toFHIR | Module that provides support for inquiry 278 response mapping. |
| fhirTo278Inquiry | Module that provides support for inquiry 278 request mapping. |
| x12SegmentTools | This module implements X12 segment tools needed for 270 and 271 segments. |
| fhirConstants | This module implements FHIR constants that are used in CoverageEligibilityRequest and Response mapping. |
| x12SegmentQualifiers | This module implements X12 segment qualifier functions. |
fhirtoAdditionalInfo275
Module that provides support for submit 275 request mapping.
Source:
.src/main/resources/dwl/Submit/fhirtoAdditionalInfo275.dwl
fhirToSubmitRequest278
Module that provides support for submit 278 request mapping.
Source:
.src/main/resources/dwl/Submit/fhirToSubmitRequest278.dwl
submitResponse278toFHIR
Module that provides support for submit 278 response mapping.
Source:
.src/main/resources/dwl/Submit/submitResponse278toFHIR.dwl
claimInquiryResponse278toFHIR
Module that provides support for inquiry 278 response mapping.
Source:
.src/main/resources/dwl/Inquiry/claimInquiryResponse278toFHIR.dwl
fhirTo278Inquiry
Module that provides support for inquiry 278 request mapping.
Source:
.src/main/resources/dwl/Inquiry/fhirTo278Inquiry.dwl
x12SegmentTools
This module implements X12 segment tools needed for
270 and 271 segments.
Source:
.src/main/resources/dwl/x12Util/x12SegmentTools.dwl
Functions
fun getResource (resourceBundle, resourceId, resourceType)
Function to get resource from bundle using either resourceId or resourceType.
param
resourceBundleis the payload bundle to be filtered.
paramresourceIdis the ID of the resource to be used for filtering resources.
paramresourceTypeis the type of resource to be used for filtering resources. Use either resourceId or resourceType for filtering.
fun createN3 (n3Type, n301, n302)
Creates a N3 address object with the provided arguments.
param
n3Typeis a string with the N3 type.
paramn301is the first address line.
paramn302is the second address line.
return A formatted N3 address object.
fun createN4 (n4Type, n401, n402, n403, n404, n407)
Creates an N4 address (city, state, zip) object with the provided arguments. Limitation - Doesn't support N407. Assuming address is within United States of America, including its territories, or Canada
param
n4Typeis a string with the N$ type.
paramn401is a string with the address city.
paramn402is a string with the address state.
paramn403is a string with the address postal code.
paramn404is a string with the address country.
paramn407is a string with the address district.
return A formatted N4 address object.
fun createDTP (dtpType, dtp01, dtp02, dtp03)
Creates a DTP (date time period) object with the provided arguments.
param
dtpTypeis a string with DTP type.
paramdtp01is a string with DTP qualifier.
paramdtp02is a string with DTP format qualifier.
paramdtp03is a string with DTP value.
return A formatted DTP object.
fun createREF (refType, ref01, ref02)
Creates a REF segment with provided arguments.
param
refTypeis a string with the provider code.
paramref01is a string with the reference identification qualifier.
paramref02is a reference with the ref02 element name being constructed with refType and REF02.
return X12 formatted REF segment.
fun getFHIRResource (inRequest, resourceId)
Function to look up a resource from the bundle based on resource's ID. Example: Pass in an Organization's ID and the response would be the Organization object from the bundle.
param
inRequest- Input request to the API.
paramresourceId- ID of resource to be looked up.
return Resource Object for the matching resource.
fun createPER (perType, per01, per02, per03, per04, per05, per06, per07, per08)
Creates a PER contact information object with the provided arguments.
param
perTypeis a string with the PER type.
paramper01is a string with the function code.
paramper02is a string with the Contact name.
paramper03is a string with the number qualifier.
paramper04is a string with the number value.
paramper05is a string with the second number qualifier.
paramper06is a string with the second number value.
paramper07is a string with the third number qualifier.
paramper08is a string with the third number value.
return A formatted PER contact information object.
fun createSV303 (inputData)
Creates a SV303 oral cavity designation object with the provided arguments.
param
inputDatais a claim resource object.
return A SV303 oral cavity object.
fun createSV3 (inputData)
Creates a SV3 dental service object with the provided arguments.
param
inputDatais a claim resource object.
return A formatted SV3 dental service object.
fun createSV1 (sv101_01, sv101_02, sv101_03, sv101_04, sv101_05, sv101_06, sv101_07, sv101_08, sv102, sv103, sv104)
Creates a SV1 professional service object with the provided arguments.
param
sv1_1is a string with the EPSDT indicator.
paramsv1_2is a string with product or service ID qualifier.
paramsv1_3is a claim resource object.
return A formatted SV1 professional service object.
fun createSBR (perType, per01, per02, per03, per04, per05, per09)
Creates a SBR contact information object with the provided arguments.
param
perTypeis a string with the PER type.
paramper01is a string with the Contact Function Code.
paramper02is a string with the Contact name.
paramper03is a string with the Communication Number Qualifier.
paramper04is a string with the Communication Number.
paramper05is a string with the Communication Number Qualifier.
paramper09is a string with the Contact Inquiry Reference.
return A formatted PER contact information object.
fun genderLookup (gndr)
Formats the provided gender string into a valid gender string that can be cast to the gender value.
param
gndris the string with gender type.
return A required gender value.
fun createDMG (dmgType, dmg01, dmg02, dmg03)
Creates a DMG demographic information object with the provided arguments.
param
dmgTypeis a string with the DMG type.
paramdmg01is a string with the format qualifier.
paramdmg02is a patient object.
return A formatted DMG demographic information object.
fun payerSequenceNumberPayerLookup (code)
Formats the provided gender string into a valid gender string that can be cast to the gender value.
param
gndris the string with gender type.
return A required gender value.
fun relationCodeX12FHIR (inCode)
Function to convert X12 relationship code to FHIR format.
param
inCodeX12 relationship code.
return FHIR format relationship code.
fun genderLookupX12FHIR (inCode)
Function to convert X12 Gender Codes to FHIR format.
param
inCodeX12 Gender code.
return FHIR format Gender code.
fun telecomTypeX12FHIR (inCode)
Function to convert X12 telecom codes to FHIR format.
param
inCodeX12 relationship code.
return FHIR format relationship code.
fun createTelecom (perSegment)
Function create telecom object for FHIR resource using X12 PER segment.
param
perSegmentPER segment from X12 message.
return telecom object formatted per FHIR specification.
fun pluckValuefromSeg (segment, selector)
Function to fetch an element from the segment with the key name prefix.
param
segmentfrom which the element value is to be extracted.
fun createPWK (pwkType, pwk01, pwk02, pwk05, pwk06)
Function that creates a PWK segment using the provided parameters.
param
pwkTypeDescribes the PWK segment being mapped.
parampwk01Report Type code.
parampwk02Report Transmission code.
parampwk05Attachment control number.
parampwk06Attachment description.
return X12 formatted BIN segment.
fun createMSG (msgType, msg01)
Function create MSG segment using the provided parameters.
param
msgTypeDescribes the MSG segment being mapped.
parammsg01Message to be written to MSG segment.
return X12 formatted MSG segment.
fun benefitTypeLookup (x12BenefitType)
Function to translate X12 benefit type to FHIR format.
param
x12BenefitType- X12 benefit type.
return FHIR benefit format benefit type.
fun createPRV (prvType, prv01, prv02, prv03)
Creates a PRV provider information object with the provided arguments.
param
prvTypedescribes the provider type being mapped. Not currently in use now, but it could be used if multiple PRV segments with varying fields names are required.
paramprv01is a string with the provider code.
paramprv02is a string with the reference identification qualifier.
paramprv03is a string with the provider taxonomy code.
return X12 formatted PRV segment.
fun termTypeLookup (x12TermCode)
Function to convert term type from X12 to FHIR.
param
x12TermCode- X12 term type.
return FHIR format term type.
fun createResponseItem (item, fhirConstants)
Function to create an item array within CoverageEligibilityResponse.
param
item- item is the input x12's EB segment.
paramitemCategorySystem- system identifier for item's category.
return - An array of item with benefit and other details.
fun fetchBenefitLoop (dependentPatientExists, benefitsLoop)
Function to fetch the benefits loop based on the patient being a subscriber or a dependent.
param
dependentPatientExists- Boolean indicating if the patient is the subscriber or dependent.
parambenefitsLoop- X12 271's 2100C or 2100D based on the patient being a dependent or subscriber.
fun createCoverageEligibilityResponse (fhirConstants, covRespId, bhtSegment, patientId, requesterType, requestorId, outcome, payorId, coverageId, benefitPeriod, benefitsLoop, dependentPatientExists)
Function to create CoverageEligibilityResponse.
param
fhirConstants- List of constants used to for identifiers and system.
paramcovRespId- Unique ID for CoverageEligibilityResponse.
parambhtSegment- BHT segment from X12 271 input.
parampatientId- the patient's ID (either subscriber or dependent) from X12 271 2100C Loop.
paramrequesterType- Type of the party sending the CoverageEligibilityRequest can be either Practitioner or Organization.
paramrequestorId- ID of the sender of the CoverageEligibilityRequest.
paramoutcome- Outcome of the 271 X12 based on AAA segment.
parampayorId- ID of the Information Source i.e. the payer in this case.
paramcoverageId- ID of the Coverage created as part of the bundle.
parambenefitPeriod- Benefit begin and end date.
parambenefitsLoop- 2110D or 2110C loop of the X12 271 based on the patient.
paramdependentPatientExists- Boolean indicating if patient is the subscriber or dependent.
fun RelationshipLookup (relateship)
Formats the provided coverage relationship string into a valid relationship string that can be cast to the relationship value. Limitation: Only supports FHIR relations: Spouse, Child and Other Relationship.
param
relateshipis the string with gender type.
return A required gender value.
fun createINS (insType, ins01, ins02)
Function to create INS segment with provided input parameters.
param
insType- INS segment for patient(subscriber or dependent).
paramins01- insured indicator.
paramins02- relationship to insured.
return An X12 formatted INS segment.
fun createINS (insType, ins01, ins02, ins08)
Creates an INS object with the provided arguments.
param
ins01is an Insured Indicator value.
paraminso2is value for Individual Relationship Code.
paramins08is a string with Employment Status Code.
return X12 formatted INS segment.
fun insuredRelationLookup (relCode)
Formats the provided relationship code into a valid code that can be cast to relationship code.
param
relCodeis the code with relationship type.
return A required relationship code.
fun createBIN (bin01)
Creates a BIN object with the provided arguments.
param
bin01is a Binary Data value.
return X12 formatted BIN segment.
fun createEFI (efi01)
Creates a EFI (Electronic Format Identification) object with the provided arguments.
param
efi01is a Security Level Code.
return X12 formatted EFI segment.
fun createCAT (cat01, cat02)
Creates a CAT (Category Of Patient Information Service) object with the provided arguments.
param
cat01is a Attachment Report Type Code.
paramcat02is a Attachment Information Format Code.
return X12 formatted CAT segment.
fun createLX (lx01)
Creates a LX object with the provided arguments.
param
lx01is a Assigned Number.
return X12 formatted LX segment.
fun createNX1 (nx1_01)
Creates a NX1 object with the provided arguments.
param
nx1_01is a Entity Identifier Code.
return X12 formatted NX1 segment.
fun providerTypeLookup (inCode)
Function to convert provider type from FHIR to X12 format.
param
inCodeFHIR format lookup value.
return X12 format qualifier for provider.
fun lookupPERCommType (inCode)
Function to convert PER segments from FHIR format to X12 format.
param
inCode- Telecom system in FHIR.
return X12 format communication type qualifier.
fun extensionLookUp (extension, valueType, url)
Function to lookup extension using URL comparison and return the appropriate code based on type of extension.
param
extension- Array of extensions to be filtered.
paramvalueType- Defines whether extension is of valueCodeableConcept or string.
paramurl- URL of the extension being filtered identifying MilitaryStatus, leveOfService etc.
fun fetchSupportingInfo (supportingInfoArray, eventCode, eventSystem)
Function to fetch claim resource's supporting Info for Patient Event, Admission, Discharge, AdditionalInfo, Message etc.
param
supportingInfoArray- List of supportinginfos from FHIR PAS Claim Resource.
parameventCode- Codeable concept's code to filter the list.
parameventSystem- Codeable concept's system to filter the list.
return - supportingInfo from FHIR Claim that matches the code and system.
fun formatPeriod (periodObject)
X12 formats the period range string with the provided FHIR period object.
param
periodObjectis an FHIR-formatted period object.
return An X12 period range string.
fun formatDateTime (str)
Formats the provided date string into a valid datetime string that can be cast to a date or a time.
param
stris the current datetime string.
return A datetime formatted string.
fun createTRN (trnType, trn01, trn02, trn03, trn04)
Creates a TRN object with the provided arguments.
param
trnTypeis a string with TRN type.
paramtrn01is value for Trace Type code.
paramtrn02is a string with TRN type Trace Number.
paramtrn03is a string with Trace Assigning Entity Identifier.
paramtrn04is a string with Trace Assigning Entity Additional Identifier.
return X12 formatted TRN segment
fun createHI (hi101, hi102, hi201, hi202)
Function to create HI segment with provided input parameters.
param
hi101- Diagnosis code classification library identifier.
paramhi102- Diagnosis code.
paramhi201- Diagnosis code classification library identifier.
paramhi202- Diagnosis code.
return An X12 formatted HI segment.
fun createHI (hi01, hi02)
Creates a HI healthcare information object with the provided arguments.
param
hi01is a segment qualifier for diagnosys code admitting.
paramhi02is a segment qualifier for diagnosys code principal.
paramhi03is a segment qualifier for diagnosys code patientreasonforvisit.
paramhi04is a string with diagnosys code.
fun createUM (um01, um02, um03, um0401, um0402, um0501, um0504, um06)
Creates an UM object with the provided arguments.
param
um01is request category code.
paramum02is certification type code.
paramum03is service type code.
paramum0401is a sub element of UM04 for facility code.
paramum0402is a sub element of UM04 for facility code qualifier.
paramum0501is a sub element of UM05 for related causes code.
paramum0504is a sub element of UM05 for state or province code.
paramum0506is the level of service code.
return X12 formatted UM segment.
fun createSubmit2000ELoop (inRequest, claimResource, segmentQualifiers, fhirConstantsObj, patientDates, claimSupportingInfo)
Function creates 2000E_Loop and its child loops like 2010EA and 2000F. 2000E_Loop includes TRN, UM, DTP,HI,PWK,MSG, 2010EA_Loop and 2000F_Loop. 2010EA_Loop includes NM1, N3, N4, PER, PRV. 2000F_Loop includes TRN, REF, UM, DTP, SV1 or SV2. This loop can occur in either 2000C at the subscriber level, when the subscriber is the patient, or it can occur at 2000D at the beneficiary level, when a dependent of the subscriber is the patient.
fun getEventLoop (loop2000E, loop2000FExists)
Function to get EventLoop from 2000E or 2000F. There are situations where, 2000F loops are not populated in the X12 message. This function looks at both and returns the one that is present
param
loop2000Eis the 2000ELoop from X12 278 Response
_paramloop2000FExistsis a boolean that identifies presence of 2000FLoop
_return Loop structure of either 2000E or 2000F
fun getExtensionValue (LoopESegName, LoopFSegName, LoopE_Element, LoopF_Element, loop2000FExists, loop2000E)
Function to get extension values segment in either 2000E or 2000F loops. There are situations where, 2000F loops are not populated in the X12 message. with parameters LoopESegName,LoopFSegName,LoopE_Element,LoopF_Element,loop2000FExists,loop2000E This function looks at both and returns the element from 2000F_Loop if it exists else from 2000E_Loop
param
LoopESegNameis the segment name from 2000ELoop of X12 278 Response
_paramLoopFSegNameis the segment name from 2000ELoop of X12 278 Response
_paramLoopE_Elementis the element name from 2000ELoop of X12 278 Response
_paramLoopF_Elementis the element name from 2000ELoop of X12 278 Response
_paramloop2000FExistsis a boolean that identifies presence of 2000FLoop
_paramloop2000Eis the 2000ELoop from X12 278 Response
_return Loop structure of either 2000E or 2000F
fun createInquiry2000ELoop (inRequest, claimResource, segmentQualifiers, fhirConstantsObj, patientDates, claimSupportingInfo)
Function creates 2000E_Loop and its child loops like 2010EA and 2000F. 2000E_Loop includes TRN, DTP, 2010EA_Loop and 2000F_Loop. 2010EA_Loop includes NM1, N3, N4, PER, PRV. 2000F_Loop includes TRN, UM, HCR, REF, DTP, SV1 or SV2. This loop can occur in either 2000C at the subscriber level, when the subscriber is the patient, or it can occur at 2000D at the beneficiary level, when a dependent of the subscriber is the patient.
fun createHCR (hcr01)
Creates a HCR segment with provided arguments.
param
hcr01is a string with the action code for HCR.
return X12 formatted HCR segment.
fhirConstants
This module implements FHIR constants that are used in CoverageEligibilityRequest and Response mapping.
Source:
.src/main/resources/dwl/x12Util/fhirConstants.dwl
Functions
fun fhirConstants ()
Gets the constants used in lookup functions.
return A map of constants used.
x12SegmentQualifiers
This module implements X12 segment qualifier functions.
Source:
.src/main/resources/dwl/x12Util/x12SegmentQualifiers.dwl
Functions
fun getSegmentQualifiers ()
Gets the segment qualifiers for the 270 and 837 transactions.
return A map of segment qualifiers.